using System;
using System.Collections.Generic;
using System.Text;
using Photogrammetry.Transformation;
using System.Drawing;
using System.Drawing.Drawing2D;
using Geometry;

namespace Raster.ReSampling
{
    class Tester
    {
        static void Main()
        {
            ReSample<Affine> AffineResampler;
            #region declarations
            Geometry.Point[] pictureVertices = new Geometry.Point[7];
            Geometry.Point[] realVertices = new Geometry.Point[7];
            pictureVertices[0] = new Geometry.Point();
            pictureVertices[1] = new Geometry.Point();
            pictureVertices[2] = new Geometry.Point();
            pictureVertices[3] = new Geometry.Point();
            pictureVertices[4] = new Geometry.Point();
            pictureVertices[5] = new Geometry.Point();
            pictureVertices[6] = new Geometry.Point();
            realVertices[0] = new Geometry.Point();
            realVertices[1] = new Geometry.Point();
            realVertices[2] = new Geometry.Point();
            realVertices[3] = new Geometry.Point();
            realVertices[4] = new Geometry.Point();
            realVertices[5] = new Geometry.Point();
            realVertices[6] = new Geometry.Point();
            #endregion

            #region pictureVertices
            pictureVertices[0].X = 520.879;
            pictureVertices[1].X = 483.349;
            pictureVertices[2].X = 500.000;
            pictureVertices[3].X = 516.691;
            pictureVertices[4].X = 503.938;
            pictureVertices[5].X = 505.071;
            pictureVertices[6].X = 487.809;

            pictureVertices[0].Y = 504.374;
            pictureVertices[1].Y = 521.842;
            pictureVertices[2].Y = 500.000;
            pictureVertices[3].Y = 522.002;
            pictureVertices[4].Y = 524.270;
            pictureVertices[5].Y = 510.617;
            pictureVertices[6].Y = 506.686;
            #endregion

            #region realVertices
            realVertices[0].X = 4940.6883;
            realVertices[1].X = 4911.1560;
            realVertices[2].X = 4925.5338;
            realVertices[3].X = 4935.9703;
            realVertices[4].X = 4926.2670;
            realVertices[5].X = 4928.3482;
            realVertices[6].X = 4915.8495;

            realVertices[0].Y = 2446.1872;
            realVertices[1].Y = 2455.7941;
            realVertices[2].Y = 2441.0398;
            realVertices[3].Y = 2458.9338;
            realVertices[4].Y = 2459.4669;
            realVertices[5].Y = 2449.4044;
            realVertices[6].Y = 2444.9145;
            #endregion
            Affine objAffine = new Affine(pictureVertices, realVertices);
            Bitmap bmp = new Bitmap("f:\\a.bmp"); //Bitmap.FromFile("f:\\a.bmp");
            ColoredPoint[] ColoredVertices = new ColoredPoint[(bmp.Width)*(bmp.Height)];
            for (int i = 0; i < bmp.Width; i++)
            {
                for (int j = 0; j < bmp.Height; j++)
                {
                    ColoredVertices[i * bmp.Height + j] = new ColoredPoint(i, j, bmp.GetPixel(i, j));
                }
                Console.WriteLine(i);
            }
            AffineResampler = new ReSample<Affine>(objAffine, ColoredVertices);
        }
    }
}
